

define(function(require,exports,module){  
	
	exports.init = function(){
		//重置金额输入框的值为空
		$("#reset_money").on("click",function(){
			$("#container_row1_column2 div input").val("");
		});
		//重置备注输入框的值为空
		$("#reset_remark").on("click",function(){
			$("#container_row2_column2 div input").val("");
		});
		//点击了提交按钮
		$("#mysubmit").on("click",function(){
			mySubmit();
		});
	};
	
});  


function mySubmit() {
	//var account = document.getElementById("accountField").value;
	var $money = $("#container_row1_column2 div input").val();
	if ($money == null || $money == "") {
		alert("金额不能为空!");
		return;
	} else if ($money.replace(/(^\s+)|(\s+$)/g, "").length == 0) { /*类似string.trim().length==0*/
		alert("金额不能为空!");
		return;
	} else if(isNaN($money)){
		alert("输入金额框中请输入数值!");
		return;
	}
	$money=$money.replace(/(^\s+)|(\s+$)/g, "");

	var $remark = $("#container_row2_column2 div input").val();
	if ($remark == null || $remark == "") {
		alert("备注不能为空!");
		return;
	} else if ($remark.replace(/(^\s+)|(\s+$)/g, "").length == 0) {
		alert("备注不能为空!");
		return;
	}
	$remark=$remark.replace(/(^\s+)|(\s+$)/g, "");
	
	
	$.post("/myBank10/myPayment/MyPayController/addPay",{amountOfMoney:$money,remark:$remark},function(result){
		if(result.STATUS=="SUCCESS"){
			$("#container_row1_column2 div input").val("");
			$("#container_row2_column2 div input").val("");
			alert("添加成功!");
		}else{
			var $fail_message = result.FAIL_MESSAGE;
			alert("操作失败!\n"+fail_message+"\n请联系管理员!");
		}
	});
}